<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
          "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core">

<f:view><ui:composition template="/WEB-INF/template/basicTemplate.xhtml">
<ui:define name="content">
	<h:inputHidden rendered="#{menuController.userRank != 1}" value="#{menuController.redirect()}"></h:inputHidden>
	<h:inputHidden value="#{menuController.setUrl(request.requestURL)}"></h:inputHidden>
	<h:inputHidden rendered="#{menuController.userRank == 1}">
	<!--  TO DO: css and validators. Don't forget to make bottom border for cells! -->
	<h:panelGrid columns="2">
		<h:outputText value="Test name"></h:outputText>
		<h:outputText value="#{correctTestBean.interview.template.title}"></h:outputText>	
		<h:outputText value="Candidate name"></h:outputText>
		<h:outputText value="#{correctTestBean.name}"></h:outputText>
		<h:outputText value="Date"></h:outputText>
		<h:outputText value="#{correctTestBean.date}"></h:outputText>	
		<h:outputText value="Room"></h:outputText>
		<h:outputText value="#{correctTestBean.interview.room.address}"></h:outputText>	

		<h:outputText value="Correct" rendered="#{correctTestBean.showTable}"  ></h:outputText>
		<h:outputText value="#{correctTestBean.totalScore}%" rendered="#{correctTestBean.showTable}" ></h:outputText>	
	
	</h:panelGrid>
<br />
		<h:dataTable value="#{correctTestBean.interview.testQuestions}" var="q"  border="0" rendered="#{correctTestBean.showTable}">
			<h:column width="300">
			<f:facet name="header">
    				Question and Answers
				</f:facet>
			<h:outputText value="#{q.question.text}" style="font-weight:bold"></h:outputText><br />
			<h:outputText value="#{q.question.answer1}"></h:outputText><br />
			<h:outputText value="#{q.question.answer2}"></h:outputText><br />
			<h:outputText value="#{q.question.answer3}"></h:outputText><br />
			<h:outputText value="#{q.question.answer4}"></h:outputText><br />
			</h:column>
			<h:column>
			<f:facet name="header">
    				Corrected
				</f:facet>
			<br />
			<h:graphicImage library="images" name="#{q.question.image1}" height="20" width="20"></h:graphicImage><br />
			<h:graphicImage library="images" name="#{q.question.image2}" height="20" width="20"></h:graphicImage><br />
			<h:graphicImage library="images" name="#{q.question.image3}" height="20" width="20"></h:graphicImage><br />
			<h:graphicImage library="images" name="#{q.question.image4}" height="20" width="20"></h:graphicImage><br />
			</h:column>
			<h:column>
			<f:facet name="header">
    				Points
				</f:facet>
			<h:outputText value="#{q.score}" style="font-weight:bold"></h:outputText><br />
			</h:column>
		</h:dataTable><br/>
		
		<h:form rendered="#{correctTestBean.showTable}" >
		<h:outputText value="Add comment" styleClass="tableTitle" /><br />
				<h:inputTextarea value="#{correctTestBean.comment}" cols="45" rows="8"></h:inputTextarea><br/>
			

		<h:commandButton value="Submit" styleClass="button" action="#{correctTestBean.setNewComment}"></h:commandButton>
		 
		</h:form >
		<h:form rendered="#{!correctTestBean.showTable}" >
		<h:outputText  value="The candidate has not taken the test yet." />
		</h:form>
		<h:form>
		<h:commandButton value="Cancel" styleClass="button" action="#{viewCandidatesBean.backFromView}"></h:commandButton>
		</h:form>
		<h:form rendered="#{!correctTestBean.showTable}" >
		<h:commandButton value="Reschedule Test" styleClass="button" rendered="#{correctTestBean.date!='N/A'}" action="#{correctTestBean.reschedule}"></h:commandButton>
		</h:form>
		
		</h:inputHidden>
	</ui:define>
</ui:composition></f:view></html>